﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html class="x-admin-sm">

<head>
    <meta name="viewport" content="width=device-width" />
    <meta charset="UTF-8">
    <title>工序信息添加</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link href="~/X-admin/css/font.css" rel="stylesheet" />
    <script src="~/X-admin/lib/layui/layui.all.js"></script>
    <link href="~/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/X-admin/js/jquery.min.js"></script>
    <script src="~/X-admin/js/xadmin.js"></script>
    <script src="~/js/framework/sysframework.js"></script>
    <script src="~/js/framework/commonjs.js"></script>

</head>
<body>
 
    <div id="bDiv">
    </div>
    <div class="layui-card" style="margin-top:10px">
        <div class="layui-card-body ">
            <form class="layui-form" id="qForm" lay-filter="form-filter">
                <input type="hidden" name="id" id="id">
                <div class="layui-form-item" style="margin-left:3%;margin-top:3%">
                    <label class="layui-form-label">
                        工序编码
                    </label>
                    <div class="layui-input-inline" style="margin-left:1%">
                        <input type="text" name="cCode" placeholder="工序编码" class="layui-input" id="cCode" autocomplete="off">
                    </div>
                    <label class="layui-form-label">
                        工序名称
                    </label>
                    <div class="layui-input-inline" style="margin-left:1%">
                        <input type="text" name="cName" placeholder="工序名称" class="layui-input" id="cName" autocomplete="off">
                    </div>

                </div>
                <div class="layui-form-item" style="margin-left:3%">
                    <label class="layui-form-label">
                     工艺表单
                    </label>
                    <div class="layui-input-inline" style="margin-left:1%">
                        <input type="text" name="cValues" placeholder="工艺表单数据" class="layui-input" id="cValues" >
                    </div>
                    <label class="layui-form-label">
                        生产序号
                    </label>
                    <div class="layui-input-inline" style="margin-left:1%">
                        <input type="text" name="orderNum" placeholder="生产序号" class="layui-input" id="orderNum" lay-verify="number">
                    </div>
                </div>
                <div class="layui-form-item" style="margin-left:3%">
                    <label class="layui-form-label">
                     备注说明
                    </label>
                    <div class="layui-input-inline" style="margin-left:1%">
                        <input type="text" name="cMemo" placeholder="备注说明" class="layui-input" style="width:300%" id="cMemo">
                    </div>
                    
                </div>

            </form>
        </div>
    </div>

</body>
</html>

<script type="text/javascript">
    var dataId = "";
    $(function () {
        dataId = getUrlVariable("dataId");
        BannerData("comUpdate", "bDiv");
        id = getUrlVariable("id");
        if (dataId != "" && dataId != "0") {
            $('#cCode').attr("readonly", "readonly") //将input元素设置为readonly
            loadData();
        }
    })
    var currPage = 1;//首先默认值为1，防止出错
    /**
    更新数据
    **/
    function saveData() {
        var name = $("input[ name='cName']").val();
        var code = $("input[ name='cCode']").val();
        if (code == "" || name == "") {
            layer.msg("请输入编码或名称");
            return;
        }
        $.ajax({
            url: "../ProductSet/UpdateGongXu",
            data: { datas: JSON.stringify(FormToJson("qForm")) },
            dataType: "json",
            type: "POST",
            success: function (data) {
                if (data.result) {
                    layer.msg("保存成功");
                    this.close();
                } else {
                    layer.msg(data.message);
                }
            }
        });
    }

    function loadData() {
        $.ajax({
            url: "../Basic/getCommonDataById",
            type: "post",
            data: { dataId: dataId },
            async: false,
            success: function (data) {
                if (data.result) {
                    layui.use('form', function () {
                        var form = layui.form;
                        form.val('form-filter', data.data[0]);
                        form.render();
                    });
                }
            }
        });
    }
</script>

